<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="../css/layui.css" rel="stylesheet">
<script type="text/javascript" src="../layui.all.js"></script>
		<title>...</title>
	
	</head>
	<body>
 <blockquote class="layui-elem-quote role_search">
     <div class="layui-inline">
        <div class="layui-input-inline">
            <input id="tableName" type="text" value="" placeholder="请输入表名" class="layui-input search_input">
        </div>
        <a class="layui-btn search_btn" onclick="queryTea()">查询</a>
    </div>
    
    
</blockquote>          
<table class="layui-hide" id="test" lay-filter="tools"></table>
              
<script type="text/html" id="tools">
	<a class="layui-btn layui-btn-xs" lay-event="acc">调用验证</a>
</script>          
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
 <script type="text/javascript" src="../js/common/jquery.min.js"></script>
<script>
var table;
var layer;

layui.use([ 'layer', 'table', 'element' ], function(){
	table = layui.table;
    layer = layui.layer;
  
  table.render({
    elem: '#test'
    ,url:'/web_seach/accDataTable/getPageDatas?type=getAll'
    ,cellMinWidth: 80 
    ,page: { //分页设定
        layout: ['count', 'prev', 'page', 'next'] //自定义分页布局
        , curr: 1 //设定初始在第 1 页
        , limit: 10//每页多少数据
        , groups: 5 //只显示 5 个连续页码
    }
    ,cols: [[
             {field:'id', width:80, title: 'ID', sort: true}
             ,{field:'dataBaseUrl', width:200, title: '数据库地址'}
             ,{field:'dataBaseName', width:150, title: '数据库名'}
             ,{field:'tableName', width:150, title: '表明'}
             ,{field:'userId', width:100, title: '所属用户id'}
             ,{field:'remark', width:150, title: '备注'}
             ,{
                 title : '操作',
                 width : 300,
                 align : 'center',
                 toolbar : '#tools'
             }
            
           ]]
  });
  
//监听工具条
  table.on('tool(tools)', function(obj) { // 注：tool是工具条事件名，test是table原始容器的属性
      var data = obj.data // 获得当前行数据
          , layEvent = obj.event; // 获得 lay-event 对应的值
      if ('acc' == layEvent) {
          acc(data.id,data.userId);
      }
  });
});

function acc(id,userId){
	var param={};
	param.callId =id;
	param.callUserId =userId;
	param.type =3;
	var url = "/web_seach/accControlMap/checkPass";
	
    $.ajax({
        url: url,
        data:param,
        success: function(data){
        	
        	alert(JSON.parse(data).msg);
        }
    });
}
</script>

</body>


</html>
